Remove all CONFIG_VTI, VTI now works dynamically
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Thu, 22 Sep 2005 12:59:57 +0000 (06:59 -0600)
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Thu, 22 Sep 2005 12:59:57 +0000 (06:59 -0600)
1.remove vcpu_set_regs and element regs,which are never used
2.remove ia64_prepare_handle_privop,ia64_prepare_handle_break, ia64_prepare_handle_reflection, which are never used.
3.modify related macros for adapting to three level physical to machine table
4.remove all CONFIG_VIT
5.merge ia64_switch_to

Signed-off-by Anthony Xu <Anthony.xu@intel.com>

30 files changed:
xen/arch/ia64/Makefile
xen/arch/ia64/Rules.mk
xen/arch/ia64/asm-offsets.c
xen/arch/ia64/asm-xsi-offsets.c
xen/arch/ia64/linux-xen/entry.S
xen/arch/ia64/linux-xen/head.S
xen/arch/ia64/linux-xen/unaligned.c
xen/arch/ia64/vmx/mm.c
xen/arch/ia64/vmx/vmmu.c
xen/arch/ia64/vmx/vmx_hypercall.c
xen/arch/ia64/vmx/vmx_init.c
xen/arch/ia64/vmx/vmx_irq_ia64.c
xen/arch/ia64/vmx/vmx_process.c
xen/arch/ia64/xen/domain.c
xen/arch/ia64/xen/grant_table.c
xen/arch/ia64/xen/hypercall.c
xen/arch/ia64/xen/privop.c
xen/arch/ia64/xen/process.c
xen/arch/ia64/xen/regionreg.c
xen/arch/ia64/xen/vcpu.c
xen/arch/ia64/xen/xenmem.c
xen/arch/ia64/xen/xenmisc.c
xen/include/asm-ia64/config.h
xen/include/asm-ia64/domain.h
xen/include/asm-ia64/ia64_int.h
xen/include/asm-ia64/mm.h
xen/include/asm-ia64/privop.h
xen/include/asm-ia64/vmx_vcpu.h
xen/include/asm-ia64/xensystem.h
xen/include/public/arch-ia64.h

index 60e31a170c78a54a5f538da4e8070f0f4daea8f5..3eabd0b7ed7aa4192baafcb716f754fc1990ced9 100644 (file)
@@ -12,15 +12,10 @@ OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \
        irq_ia64.o irq_lsapic.o vhpt.o xenasm.o hyperprivop.o dom_fw.o \
        grant_table.o sn_console.o
 
-# TMP holder to contain *.0 moved out of CONFIG_VTI
-OBJS += vmx_init.o
-
-ifeq ($(CONFIG_VTI),y)
-OBJS += vmx_virt.o vmx_vcpu.o vmx_process.o vmx_vsa.o vmx_ivt.o\
+OBJS += vmx_init.o vmx_virt.o vmx_vcpu.o vmx_process.o vmx_vsa.o vmx_ivt.o\
        vmx_phy_mode.o vmx_utility.o vmx_interrupt.o vmx_entry.o vmmu.o \
        vtlb.o mmio.o vlsapic.o vmx_hypercall.o mm.o vmx_support.o \
        pal_emul.o vmx_irq_ia64.o
-endif
 
 # lib files from xen/arch/ia64/linux/ (linux/arch/ia64/lib)
 OBJS +=        bitop.o clear_page.o flush.o copy_page_mck.o                    \
index d1a1dc4a957d1b8d5e071a1b64b31496dff59cd2..8eb31cc674be949d378be8fea4d5dd4616ac126a 100644 (file)
@@ -1,7 +1,7 @@
 ########################################
 # ia64-specific definitions
 
-CONFIG_VTI     ?= n
+VALIDATE_VT    ?= n
 ifneq ($(COMPILE_ARCH),$(TARGET_ARCH))
 CROSS_COMPILE ?= /usr/local/sp_env/v2.2.5/i686/bin/ia64-unknown-linux-
 endif
@@ -27,7 +27,7 @@ CFLAGS  += -Wno-pointer-arith -Wredundant-decls
 CFLAGS  += -DIA64 -DXEN -DLINUX_2_6
 CFLAGS += -ffixed-r13 -mfixed-range=f12-f15,f32-f127
 CFLAGS += -w -g
-ifeq ($(CONFIG_VTI),y)
-CFLAGS  += -DCONFIG_VTI
+ifeq ($(VALIDATE_VT),y)
+CFLAGS  += -DVALIDATE_VT
 endif
 LDFLAGS := -g
index ad0fbcf9b04047110a3cdfd8c4a001520e03c97a..8c1dfe6d6c2803cff0e2dd749054bd7bec142e40 100644 (file)
@@ -9,10 +9,8 @@
 #include <asm/processor.h>
 #include <asm/ptrace.h>
 #include <public/xen.h>
-#ifdef CONFIG_VTI
 #include <asm/tlb.h>
 #include <asm/regs.h>
-#endif // CONFIG_VTI
 
 #define task_struct vcpu
 
@@ -222,14 +220,12 @@ void foo(void)
 
        BLANK();
 
-#ifdef  CONFIG_VTI
        DEFINE(IA64_VPD_BASE_OFFSET, offsetof (struct vcpu, arch.privregs));
        DEFINE(IA64_VLSAPIC_INSVC_BASE_OFFSET, offsetof (struct vcpu, arch.insvc[0]));
        DEFINE(IA64_VPD_CR_VPTA_OFFSET, offsetof (cr_t, pta));
        DEFINE(XXX_THASH_SIZE, sizeof (thash_data_t));
 
        BLANK();
-#endif  //CONFIG_VTI
        //DEFINE(IA64_SIGCONTEXT_IP_OFFSET, offsetof (struct sigcontext, sc_ip));
        //DEFINE(IA64_SIGCONTEXT_AR_BSP_OFFSET, offsetof (struct sigcontext, sc_ar_bsp));
        //DEFINE(IA64_SIGCONTEXT_AR_FPSR_OFFSET, offsetof (struct sigcontext, sc_ar_fpsr));
index 80d5809ffd9440e9117e74f94869150578532f4b..6a2c6dfa40ee400bdca90a7dcc3d8a0ace6d7555 100755 (executable)
 #include <asm/processor.h>
 #include <asm/ptrace.h>
 #include <public/xen.h>
-#ifdef CONFIG_VTI
 #include <asm/tlb.h>
 #include <asm/regs.h>
-#endif // CONFIG_VTI
 
 #define task_struct vcpu
 
index 22f68b8950a617e460e0da6d46a92eb6312e1348..c4f24489429911b0c2ada4343a569e970606379a 100644 (file)
@@ -223,9 +223,20 @@ GLOBAL_ENTRY(ia64_switch_to)
 #else
        mov IA64_KR(CURRENT)=in0        // update "current" application register
 #endif
+#ifdef XEN          //for VTI domain current is save to 21 of bank0
+    ;;
+    bsw.0
+    ;;
        mov r8=r13                      // return pointer to previously running task
        mov r13=in0                     // set "current" pointer
+    mov r21=in0
+    ;;
+    bsw.1
        ;;
+#else
+    mov r8=r13          // return pointer to previously running task
+    mov r13=in0         // set "current" pointer
+#endif
        DO_LOAD_SWITCH_STACK
 
 #ifdef CONFIG_SMP
@@ -632,12 +643,14 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
 #ifdef XEN
        // new domains are cloned but not exec'ed so switch to user mode here
        cmp.ne pKStk,pUStk=r0,r0
-#ifdef CONFIG_VTI
-    br.cond.spnt ia64_leave_hypervisor
-#else // CONFIG_VTI
-    br.cond.spnt ia64_leave_kernel
-#endif // CONFIG_VTI
-
+    adds r16 = IA64_VCPU_FLAGS_OFFSET, r13
+    ;;
+    ld8 r16 = [r16]
+    ;;
+    cmp.ne p6,p7 = r16, r0
+ (p6) br.cond.spnt ia64_leave_hypervisor
+ (p7) br.cond.spnt ia64_leave_kernel
+    ;;
 //    adds r16 = IA64_VCPU_FLAGS_OFFSET, r13
 //    ;;
 //    ld8 r16 = [r16]
index 8208e899f02aad99ed1c5587f18f5d8f72e6cf23..9da143d979a2de10b311ecdc105d65fae34aa020 100644 (file)
@@ -259,7 +259,7 @@ start_ap:
        /*
         * Switch into virtual mode:
         */
-#if defined(XEN) && defined(CONFIG_VTI)
+#if defined(XEN) && defined(VALIDATE_VT)
        movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH\
                  |IA64_PSR_DI)
 #else
@@ -284,7 +284,7 @@ start_ap:
        ;;
 
        // set IVT entry point---can't access I/O ports without it
-#if defined(XEN) && defined(CONFIG_VTI)
+#if defined(XEN) && defined(VALIDATE_VT)
        movl r3=vmx_ia64_ivt
 #else
        movl r3=ia64_ivt
@@ -356,7 +356,7 @@ start_ap:
 
 .load_current:
        // load the "current" pointer (r13) and ar.k6 with the current task
-#if defined(XEN) && defined(CONFIG_VTI)
+#if defined(XEN) && defined(VALIDATE_VT)
        mov r21=r2
        ;;
        bsw.1
index 29f412ce643ce4961dab66c16d108cc3a330172b..8b1cf71eecb702879a26398d8954b7c26d134fdc 100644 (file)
@@ -201,12 +201,11 @@ static u16 gr_info[32]={
 
        RPT(r1), RPT(r2), RPT(r3),
 
-//#if defined(XEN) && defined(CONFIG_VTI)
 #if defined(XEN)
        RPT(r4), RPT(r5), RPT(r6), RPT(r7),
-#else   //CONFIG_VTI
+#else
        RSW(r4), RSW(r5), RSW(r6), RSW(r7),
-#endif  //CONFIG_VTI
+#endif
 
        RPT(r8), RPT(r9), RPT(r10), RPT(r11),
        RPT(r12), RPT(r13), RPT(r14), RPT(r15),
@@ -296,7 +295,6 @@ rotate_reg (unsigned long sor, unsigned long rrb, unsigned long reg)
        return reg;
 }
 
-//#if defined(XEN) && defined(CONFIG_VTI)
 #if defined(XEN)
 void
 set_rse_reg (struct pt_regs *regs, unsigned long r1, unsigned long val, unsigned long nat)
@@ -414,7 +412,7 @@ get_rse_reg (struct pt_regs *regs, unsigned long r1, unsigned long *val, unsigne
     }
 }
 
-#else // CONFIG_VTI
+#else
 static void
 set_rse_reg (struct pt_regs *regs, unsigned long r1, unsigned long val, int nat)
 {
@@ -559,7 +557,7 @@ get_rse_reg (struct pt_regs *regs, unsigned long r1, unsigned long *val, int *na
                *nat = 0;
        return;
 }
-#endif // CONFIG_VTI
+#endif
 
 
 #ifdef XEN
@@ -595,11 +593,11 @@ setreg (unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs)
                unat = &sw->ar_unat;
        } else {
                addr = (unsigned long)regs;
-#if defined(XEN) && defined(CONFIG_VTI)
+#if defined(XEN)
                unat = &regs->eml_unat;
-#else //CONFIG_VTI
+#else
                unat = &sw->caller_unat;
-#endif  //CONFIG_VTI
+#endif
        }
        DPRINT("tmp_base=%lx switch_stack=%s offset=%d\n",
               addr, unat==&sw->ar_unat ? "yes":"no", GR_OFFS(regnum));
@@ -785,11 +783,11 @@ getreg (unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs
                unat = &sw->ar_unat;
        } else {
                addr = (unsigned long)regs;
-#if defined(XEN) && defined(CONFIG_VTI)
+#if defined(XEN)
                unat = &regs->eml_unat;;
-#else   //CONFIG_VTI
+#else
                unat = &sw->caller_unat;
-#endif  //CONFIG_VTI
+#endif
        }
 
        DPRINT("addr_base=%lx offset=0x%x\n", addr,  GR_OFFS(regnum));
index 7af69ebe08657099cca50256e49132b31402c85b..4d3ed238fa4e0d5df534cb0b707f06b925fd6a85 100644 (file)
         uregs->ptr is virtual address
         uregs->val is pte value
  */
-#ifdef CONFIG_VTI
-int do_mmu_update(mmu_update_t *ureqs,u64 count,u64 *pdone,u64 foreigndom)
+int vmx_do_mmu_update(mmu_update_t *ureqs,u64 count,u64 *pdone,u64 foreigndom)
 {
     int i,cmd;
     u64 mfn, gpfn;
@@ -149,4 +148,3 @@ int do_mmu_update(mmu_update_t *ureqs,u64 count,u64 *pdone,u64 foreigndom)
     }
     return 0;
 }
-#endif
index 9a00754366e6deb72059e0c301628a14d096be0d..99e50cc50b9886ca6bc19f5ab7d64359f1407720 100644 (file)
@@ -220,6 +220,7 @@ thash_cb_t *init_domain_tlb(struct vcpu *d)
  * by control panel. Dom0 has gpfn identical to mfn, which doesn't need
  * this interface at all.
  */
+#if 0
 void
 alloc_pmt(struct domain *d)
 {
@@ -234,7 +235,7 @@ alloc_pmt(struct domain *d)
     d->arch.pmt = page_to_virt(page);
     memset(d->arch.pmt, 0x55, d->max_pages * 8);
 }
-
+#endif
 /*
  * Insert guest TLB to machine TLB.
  *  data:   In TLB format
index 6414b01a1d84f49838999a95e7421624e67610a6..727a1450333511e7de6b6cfe0f2a483d0d216f8c 100644 (file)
@@ -47,11 +47,13 @@ void hyper_mmu_update(void)
     vcpu_get_gr_nat(vcpu,17,&r33);
     vcpu_get_gr_nat(vcpu,18,&r34);
     vcpu_get_gr_nat(vcpu,19,&r35);
-    ret=do_mmu_update((mmu_update_t*)r32,r33,r34,r35);
+    ret=vmx_do_mmu_update((mmu_update_t*)r32,r33,r34,r35);
     vcpu_set_gr(vcpu, 8, ret, 0);
     vmx_vcpu_increment_iip(vcpu);
 }
-
+/* turn off temporarily, we will merge hypercall parameter convention with xeno, when
+    VTI domain need to call hypercall */
+#if 0
 unsigned long __hypercall_create_continuation(
     unsigned int op, unsigned int nr_args, ...)
 {
@@ -87,7 +89,7 @@ unsigned long __hypercall_create_continuation(
     va_end(args);
     return op;
 }
-
+#endif
 void hyper_dom_mem_op(void)
 {
     VCPU *vcpu=current;
@@ -184,14 +186,13 @@ void hyper_lock_page(void)
 
 static int do_set_shared_page(VCPU *vcpu, u64 gpa)
 {
-    u64 shared_info, o_info;
+    u64 o_info;
     struct domain *d = vcpu->domain;
     struct vcpu *v;
     if(vcpu->domain!=dom0)
         return -EPERM;
-    shared_info = __gpa_to_mpa(vcpu->domain, gpa);
     o_info = (u64)vcpu->domain->shared_info;
-    d->shared_info= (shared_info_t *)__va(shared_info);
+    d->shared_info= (shared_info_t *)domain_mpa_to_imva(vcpu->domain, gpa);
 
     /* Copy existing shared info into new page */
     if (o_info) {
index a5624eb3fd98f18601a63de0cb72cadf40fb57fa..d6b9d24f0381b3eca9901d04b2d3fb9b49fa93b0 100644 (file)
@@ -163,7 +163,8 @@ void vmx_setup_platform(struct vcpu *v, struct vcpu_guest_context *c)
        }
 
        /* FIXME: only support PMT table continuously by far */
-       d->arch.pmt = __va(c->pt_base);
+//     d->arch.pmt = __va(c->pt_base);
+
 
        vmx_final_setup_domain(d);
 }
@@ -209,7 +210,6 @@ static vpd_t *alloc_vpd(void)
 }
 
 
-#ifdef CONFIG_VTI
 /*
  * Create a VP on intialized VMX environment.
  */
@@ -333,7 +333,6 @@ vmx_change_double_mapping(struct vcpu *v, u64 oldrr7, u64 newrr7)
                                  pte_xen, pte_vhpt);
 }
 #endif // XEN_DBL_MAPPING
-#endif // CONFIG_VTI
 
 /*
  * Initialize VMX envirenment for guest. Only the 1st vp/vcpu
@@ -355,7 +354,11 @@ vmx_final_setup_domain(struct domain *d)
     v->arch.privregs = vpd;
        vpd->virt_env_vaddr = vm_buffer;
 
-#ifdef CONFIG_VTI
+       /* Per-domain vTLB and vhpt implementation. Now vmx domain will stick
+        * to this solution. Maybe it can be deferred until we know created
+        * one as vmx domain */
+       v->arch.vtlb = init_domain_tlb(v);
+
        /* v->arch.schedule_tail = arch_vmx_do_launch; */
        vmx_create_vp(v);
 
@@ -369,7 +372,6 @@ vmx_final_setup_domain(struct domain *d)
 
        vlsapic_reset(v);
        vtm_init(v);
-#endif
 
        /* Other vmx specific initialization work */
 }
@@ -483,7 +485,7 @@ int vmx_alloc_contig_pages(struct domain *d)
            for (j = io_ranges[i].start;
                 j < io_ranges[i].start + io_ranges[i].size;
                 j += PAGE_SIZE)
-               map_domain_io_page(d, j);
+               map_domain_page(d, j, io_ranges[i].type);
        }
 
        set_bit(ARCH_VMX_CONTIG_MEM, &v->arch.arch_vmx.flags);
index 19827329b2148c220332c2982ea6dcd514a5f6aa..84af87da4104a8f8d8893dd4c8e66f787c824b7d 100644 (file)
@@ -36,7 +36,6 @@
 
 #define IRQ_DEBUG      0
 
-#ifdef  CONFIG_VTI
 #define vmx_irq_enter()                \
        add_preempt_count(HARDIRQ_OFFSET);
 
@@ -130,4 +129,3 @@ vmx_ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
        if ( wake_dom0 && current != dom0 ) 
                vcpu_wake(dom0->vcpu[0]);
 }
-#endif
index 824ea618b16c5d46cb392107dcc89a5f0e7b9beb..055687c9a3535373ab4cb12205bc486de230bee4 100644 (file)
@@ -314,11 +314,12 @@ void vmx_hpw_miss(u64 vadr , u64 vec, REGS* regs)
 //    prepare_if_physical_mode(v);
 
     if(data=vtlb_lookup_ex(vtlb, vrr.rid, vadr,type)){
-        if(v->domain!=dom0&&type==DSIDE_TLB && __gpfn_is_io(v->domain, data->ppn>>(PAGE_SHIFT-12))){
+        if(v->domain!=dom0&&type==DSIDE_TLB && __gpfn_is_io(v->domain,data->ppn>>(PAGE_SHIFT-12))){
             vadr=(vadr&((1UL<<data->ps)-1))+(data->ppn>>(data->ps-12)<<data->ps);
             emulate_io_inst(v, vadr, data->ma);
             return IA64_FAULT;
         }
+
        if ( data->ps != vrr.ps ) {
                machine_tlb_insert(v, data);
        }
index 97b63af658f26a0d25a5232a9a90f58529960efb..4cd54a0b8c4d323ef55fa18f6d2c07b4e6fd9897 100644 (file)
@@ -7,7 +7,7 @@
  *  Copyright (C) 2005 Intel Co
  *     Kun Tian (Kevin Tian) <kevin.tian@intel.com>
  *
- * 05/04/29 Kun Tian (Kevin Tian) <kevin.tian@intel.com> Add CONFIG_VTI domain support
+ * 05/04/29 Kun Tian (Kevin Tian) <kevin.tian@intel.com> Add VTI domain support
  */
 
 #include <xen/config.h>
@@ -204,13 +204,6 @@ void arch_do_createdomain(struct vcpu *v)
 
        d->max_pages = (128UL*1024*1024)/PAGE_SIZE; // 128MB default // FIXME
 
-#ifdef CONFIG_VTI
-       /* Per-domain vTLB and vhpt implementation. Now vmx domain will stick
-        * to this solution. Maybe it can be deferred until we know created
-        * one as vmx domain */
-       v->arch.vtlb = init_domain_tlb(v);
-#endif
-
        /* We may also need emulation rid for region4, though it's unlikely
         * to see guest issue uncacheable access in metaphysical mode. But
         * keep such info here may be more sane.
@@ -361,7 +354,6 @@ void new_thread(struct vcpu *v,
        regs->ar_fpsr = FPSR_DEFAULT;
 
        if (VMX_DOMAIN(v)) {
-#ifdef CONFIG_VTI
                vmx_init_all_rr(v);
                if (d == dom0)
 //                 VCPU(v,vgr[12]) = dom_fw_setup(d,saved_command_line,256L);
@@ -369,7 +361,6 @@ void new_thread(struct vcpu *v,
                /* Virtual processor context setup */
                VCPU(v, vpsr) = IA64_PSR_BN;
                VCPU(v, dcr) = 0;
-#endif
        } else {
                init_all_rr(v);
                if (d == dom0) 
@@ -480,7 +471,7 @@ void map_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physa
        }
        else printk("map_domain_page: mpaddr %lx already mapped!\n",mpaddr);
 }
-
+#if 0
 /* map a physical address with specified I/O flag */
 void map_domain_io_page(struct domain *d, unsigned long mpaddr, unsigned long flags)
 {
@@ -517,7 +508,7 @@ void map_domain_io_page(struct domain *d, unsigned long mpaddr, unsigned long fl
        }
        else printk("map_domain_page: mpaddr %lx already mapped!\n",mpaddr);
 }
-
+#endif
 void mpafoo(unsigned long mpaddr)
 {
        extern unsigned long privop_trace;
@@ -571,7 +562,7 @@ tryagain:
 }
 
 // FIXME: ONLY USE FOR DOMAIN PAGE_SIZE == PAGE_SIZE
-#ifndef CONFIG_VTI
+#if 1
 unsigned long domain_mpa_to_imva(struct domain *d, unsigned long mpaddr)
 {
        unsigned long pte = lookup_domain_mpa(d,mpaddr);
@@ -582,14 +573,14 @@ unsigned long domain_mpa_to_imva(struct domain *d, unsigned long mpaddr)
        imva |= mpaddr & ~PAGE_MASK;
        return(imva);
 }
-#else // CONFIG_VTI
+#else
 unsigned long domain_mpa_to_imva(struct domain *d, unsigned long mpaddr)
 {
     unsigned long imva = __gpa_to_mpa(d, mpaddr);
 
     return __va(imva);
 }
-#endif // CONFIG_VTI
+#endif
 
 // remove following line if not privifying in memory
 //#define HAVE_PRIVIFY_MEMORY
@@ -860,7 +851,7 @@ int construct_dom0(struct domain *d,
        if ( rc != 0 )
            return rc;
 
-#ifdef CONFIG_VTI
+#ifdef VALIDATE_VT
        /* Temp workaround */
        if (running_on_sim)
            dsi.xen_section_string = (char *)1;
@@ -920,7 +911,7 @@ int construct_dom0(struct domain *d,
        for ( i = 1; i < MAX_VIRT_CPUS; i++ )
            d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
 
-#ifdef CONFIG_VTI
+#ifdef VALIDATE_VT 
        /* Construct a frame-allocation list for the initial domain, since these
         * pages are allocated by boot allocator and pfns are not set properly
         */
@@ -938,10 +929,6 @@ int construct_dom0(struct domain *d,
            machine_to_phys_mapping[mfn] = mfn;
        }
 
-       /* Dom0's pfn is equal to mfn, so there's no need to allocate pmt
-        * for dom0
-        */
-       d->arch.pmt = NULL;
 #endif
 
        /* Copy the OS image. */
@@ -1162,12 +1149,8 @@ void vcpu_migrate_cpu(struct vcpu *v, int newcpu)
 void sync_vcpu_execstate(struct vcpu *v)
 {
        ia64_save_fpu(v->arch._thread.fph);
-#ifdef CONFIG_VTI
        if (VMX_DOMAIN(v))
                vmx_save_state(v);
-#else
-       if (0) do {} while(0);
-#endif
        else {
                if (IA64_HAS_EXTRA_STATE(v))
                        ia64_save_extra(v);
index fd66986e07dbc79a208d018056cab11506f772b4..2905861dd49786498c80e12f4c09818faba0ec67 100644 (file)
@@ -1,4 +1,3 @@
-#ifndef CONFIG_VTI
 // temporarily in arch/ia64 until can merge into common/grant_table.c
 /******************************************************************************
  * common/grant_table.c
@@ -1452,7 +1451,6 @@ grant_table_init(
 {
     /* Nothing. */
 }
-#endif
 
 /*
  * Local variables:
index 79d69db9965cd1f5fd510db6001158a2d61a7bfb..c8abf6d11549c6fc22bba769c2f196a442be68d2 100644 (file)
@@ -178,11 +178,9 @@ ia64_hypercall (struct pt_regs *regs)
                regs->r8 = do_event_channel_op(regs->r14);
                break;
 
-#ifndef CONFIG_VTI
            case __HYPERVISOR_grant_table_op:
                regs->r8 = do_grant_table_op(regs->r14, regs->r15, regs->r16);
                break;
-#endif
 
            case __HYPERVISOR_console_io:
                regs->r8 = do_console_io(regs->r14, regs->r15, regs->r16);
index 36fa02831bcd1fb32e7a28757a6bf99a3ed4e1b7..def644c30e691013f78d0d775c9d16fcb0c09402 100644 (file)
@@ -726,7 +726,6 @@ priv_emulate(VCPU *vcpu, REGS *regs, UINT64 isr)
                return IA64_ILLOP_FAULT;
        }
        //if (isrcode != 1 && isrcode != 2) return 0;
-       vcpu_set_regs(vcpu,regs);
        privlvl = (ipsr & IA64_PSR_CPL) >> IA64_PSR_CPL0_BIT;
        // its OK for a privified-cover to be executed in user-land
        fault = priv_handle_op(vcpu,regs,privlvl);
index a58a9379476b7ab57711e3a748d0c280cfc68241..0e975b668f080d5fdfa52b9195a78c3421ee7e0e 100644 (file)
@@ -67,14 +67,14 @@ void schedule_tail(struct vcpu *next)
        unsigned long rr7;
        //printk("current=%lx,shared_info=%lx\n",current,current->vcpu_info);
        //printk("next=%lx,shared_info=%lx\n",next,next->vcpu_info);
-#ifdef CONFIG_VTI
        /* rr7 will be postponed to last point when resuming back to guest */
-       vmx_load_all_rr(current);
-#else // CONFIG_VTI
-       if (rr7 = load_region_regs(current)) {
-               printk("schedule_tail: change to rr7 not yet implemented\n");
-       }
-#endif // CONFIG_VTI
+    if(VMX_DOMAIN(current)){
+       vmx_load_all_rr(current);
+    }else{
+           if (rr7 = load_region_regs(current)) {
+                   printk("schedule_tail: change to rr7 not yet implemented\n");
+       }
+    }
 }
 
 void tdpfoo(void) { }
@@ -755,7 +755,7 @@ unsigned long __hypercall_create_continuation(
 {
     struct mc_state *mcs = &mc_state[smp_processor_id()];
     VCPU *vcpu = current;
-    struct cpu_user_regs *regs = vcpu->arch.regs;
+    struct cpu_user_regs *regs = vcpu_regs(vcpu);
     unsigned int i;
     va_list args;
 
index fa0d1192585a2b8e3e57dbfc1daab810fba87410..418ba8df2359c6c43795b88f0ce4f8309b0122ca 100644 (file)
@@ -227,7 +227,7 @@ int set_one_rr(unsigned long rr, unsigned long val)
                return 0;
        }
 
-#ifdef CONFIG_VTI
+#if 0
        memrrv.rrval = rrv.rrval;
        if (rreg == 7) {
                newrrv.rid = newrid;
index dcce55759ea882c692c15559b5be1026e2810544..44c13b1eb62eb9b230d33d5b23bad4d837e7b6ec 100644 (file)
@@ -1977,7 +1977,3 @@ IA64FAULT vcpu_ptr_i(VCPU *vcpu,UINT64 vadr,UINT64 addr_range)
        return (IA64_ILLOP_FAULT);
 }
 
-void vcpu_set_regs(VCPU *vcpu, REGS *regs)
-{
-       vcpu->arch.regs = regs;
-}
index 42b83d97a2628a496ef8900786be269401539656..31c9ae3b51358b5ec59527264f7ab5008a1b718f 100644 (file)
@@ -28,17 +28,13 @@ static unsigned long num_dma_physpages;
 /*
  * Set up the page tables.
  */
-#ifdef CONFIG_VTI
 unsigned long *mpt_table;
 unsigned long mpt_table_size;
-#endif // CONFIG_VTI
 
 void
 paging_init (void)
 {
        struct pfn_info *pg;
-
-#ifdef CONFIG_VTI
        unsigned int mpt_order;
        /* Create machine to physical mapping table
         * NOTE: similar to frame table, later we may need virtually
@@ -53,8 +49,6 @@ paging_init (void)
 
        printk("machine to physical table: 0x%lx\n", (u64)mpt_table);
        memset(mpt_table, INVALID_M2P_ENTRY, mpt_table_size);
-#endif // CONFIG_VTI
-
        /* Other mapping setup */
 
        zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
index 967d6789dd536136c59c23a0844382c6237f4df4..49a44e000176b84373be01a9d88c33fa67e2d496 100644 (file)
@@ -65,7 +65,7 @@ platform_is_hp_ski(void)
 
 void sync_lazy_execstate_cpu(unsigned int cpu) {}
 
-#ifdef CONFIG_VTI
+#if 0
 int grant_table_create(struct domain *d) { return 0; }
 void grant_table_destroy(struct domain *d) { return; }
 #endif
@@ -77,7 +77,6 @@ void raise_actimer_softirq(void)
        raise_softirq(AC_TIMER_SOFTIRQ);
 }
 
-#ifndef CONFIG_VTI
 unsigned long
 __gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
 {
@@ -93,7 +92,7 @@ while(1);
                return ((pte & _PFN_MASK) >> PAGE_SHIFT);
        }
 }
-
+#if 0
 u32
 __mfn_to_gpfn(struct domain *d, unsigned long frame)
 {
@@ -288,14 +287,14 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
 //if (prev->domain->domain_id == 1 && next->domain->domain_id == 0) cs10foo();
 //if (prev->domain->domain_id == 0 && next->domain->domain_id == 1) cs01foo();
 //printk("@@sw %d->%d\n",prev->domain->domain_id,next->domain->domain_id);
-#ifdef CONFIG_VTI
-       vtm_domain_out(prev);
-#endif
+    if(VMX_DOMAIN(prev)){
+       vtm_domain_out(prev);
+    }
        context_switch_count++;
        switch_to(prev,next,prev);
-#ifdef CONFIG_VTI
-        vtm_domain_in(current);
-#endif
+    if(VMX_DOMAIN(current)){
+        vtm_domain_in(current);
+    }
 
 // leave this debug for now: it acts as a heartbeat when more than
 // one domain is active
@@ -307,16 +306,15 @@ if (!cnt[id]--) { printk("%x",id); cnt[id] = 500000; }
 if (!i--) { printk("+",id); i = 1000000; }
 }
 
-#ifdef CONFIG_VTI
-       if (VMX_DOMAIN(current))
+       if (VMX_DOMAIN(current)){
                vmx_load_all_rr(current);
-#else
-       if (!is_idle_task(current->domain)) {
-               load_region_regs(current);
-               if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
-       }
-       if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
-#endif
+    }else{
+       if (!is_idle_task(current->domain)) {
+               load_region_regs(current);
+                   if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
+       }
+           if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
+    }
 }
 
 void context_switch_finalise(struct vcpu *next)
index af5c6893e07be9cd7be7e601d58efcfb38a6a01c..1d3ba8dabdfab5f46c05c474d889ce99a7a3e81e 100644 (file)
@@ -199,11 +199,11 @@ void sort_main_extable(void);
      access_ok(type,addr,count*size))
 
 // see drivers/char/console.c
-#ifndef CONFIG_VTI
+#ifndef VALIDATE_VT
 #define        OPT_CONSOLE_STR "com1"
-#else // CONFIG_VTI
+#else
 #define        OPT_CONSOLE_STR "com2"
-#endif // CONFIG_VTI
+#endif
 
 #define __attribute_used__     __attribute__ ((unused))
 #define __nocast
index 6a25760c7874657b8cfdd4c46bd531ab550b1937..6904cf7d21a35f620483017969e4a5b3c2ce37f4 100644 (file)
@@ -25,7 +25,6 @@ struct arch_domain {
     int breakimm;
 
     int imp_va_msb;
-    unsigned long *pmt;        /* physical to machine table */
     /* System pages out of guest memory, like for xenstore/console */
     unsigned long sys_pgnr;
     unsigned long max_pfn; /* Max pfn including I/O holes */
@@ -62,7 +61,6 @@ struct arch_vcpu {
        unsigned long xen_itm;
        unsigned long xen_timer_interval;
 #endif
-    void *regs;        /* temporary until find a better way to do privops */
     mapped_regs_t *privregs; /* save the state of vcpu */
     int metaphysical_rr0;              // from arch_domain (so is pinned)
     int metaphysical_rr4;              // from arch_domain (so is pinned)
index 5808a99be5added4a56a56fec1671b1f073b31c3..c2a1aec0b0b02cbfaa4077766a39d44c2f3b5d1b 100644 (file)
@@ -45,7 +45,7 @@
 #define        IA64_DISIST_FAULT       (IA64_GENEX_VECTOR | 0x40)
 #define        IA64_ILLDEP_FAULT       (IA64_GENEX_VECTOR | 0x80)
 #define        IA64_DTLB_FAULT         (IA64_DATA_TLB_VECTOR)
-#define IA64_VHPT_FAULT     (IA64_VHPT_TRANS_VECTOR | 0x10)
+#define IA64_VHPT_FAULT     (IA64_VHPT_TRANS_VECTOR | 0x7)
 #if !defined(__ASSEMBLY__)
 typedef unsigned long IA64FAULT;
 typedef unsigned long IA64INTVECTOR;
index 93acb34776a46563fdbf07dec543ea0f044f3360..100400cb5cb91744e1703c2a1050c88d8f3e6177 100644 (file)
@@ -134,7 +134,7 @@ void add_to_domain_alloc_list(unsigned long ps, unsigned long pe);
 
 static inline void put_page(struct pfn_info *page)
 {
-#ifdef CONFIG_VTI      // doesn't work with non-VTI in grant tables yet
+#ifdef VALIDATE_VT     // doesn't work with non-VTI in grant tables yet
     u32 nx, x, y = page->count_info;
 
     do {
@@ -152,7 +152,7 @@ static inline void put_page(struct pfn_info *page)
 static inline int get_page(struct pfn_info *page,
                            struct domain *domain)
 {
-#ifdef CONFIG_VTI
+#ifdef VALIDATE_VT
     u64 x, nx, y = *((u64*)&page->count_info);
     u32 _domain = pickle_domptr(domain);
 
@@ -404,7 +404,6 @@ extern unsigned long num_physpages;
 extern unsigned long totalram_pages;
 extern int nr_swap_pages;
 
-#ifdef CONFIG_VTI
 extern unsigned long *mpt_table;
 #undef machine_to_phys_mapping
 #define machine_to_phys_mapping        mpt_table
@@ -415,34 +414,29 @@ extern unsigned long *mpt_table;
 /* If pmt table is provided by control pannel later, we need __get_user
 * here. However if it's allocated by HV, we should access it directly
 */
-#define get_mfn_from_pfn(d, gpfn)                      \
-    ((d) == dom0 ? gpfn :                                      \
-       (gpfn <= d->arch.max_pfn ? (d)->arch.pmt[(gpfn)] :      \
-               INVALID_MFN))
 
 #define __mfn_to_gpfn(_d, mfn)                 \
     machine_to_phys_mapping[(mfn)]
 
 #define __gpfn_to_mfn(_d, gpfn)                        \
-    get_mfn_from_pfn((_d), (gpfn))
+    __gpfn_to_mfn_foreign((_d), (gpfn))
 
 #define __gpfn_invalid(_d, gpfn)                       \
-       (__gpfn_to_mfn((_d), (gpfn)) & GPFN_INV_MASK)
+       (lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT)) & GPFN_INV_MASK)
 
 #define __gpfn_valid(_d, gpfn) !__gpfn_invalid(_d, gpfn)
 
 /* Return I/O type if trye */
 #define __gpfn_is_io(_d, gpfn)                         \
        (__gpfn_valid(_d, gpfn) ?                       \
-       (__gpfn_to_mfn((_d), (gpfn)) & GPFN_IO_MASK) : 0)
+       (lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT)) & GPFN_IO_MASK) : 0)
 
 #define __gpfn_is_mem(_d, gpfn)                                \
        (__gpfn_valid(_d, gpfn) ?                       \
-       ((__gpfn_to_mfn((_d), (gpfn)) & GPFN_IO_MASK) == GPFN_MEM) : 0)
+       (lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT) & GPFN_IO_MASK) == GPFN_MEM) : 0)
 
 
-#define __gpa_to_mpa(_d, gpa)   \
-    ((__gpfn_to_mfn((_d),(gpa)>>PAGE_SHIFT)<<PAGE_SHIFT)|((gpa)&~PAGE_MASK))
-#endif // CONFIG_VTI
+//#define __gpa_to_mpa(_d, gpa)   \
+//    ((__gpfn_to_mfn((_d),(gpa)>>PAGE_SHIFT)<<PAGE_SHIFT)|((gpa)&~PAGE_MASK))
 
 #endif /* __ASM_IA64_MM_H__ */
index 552ae82f8c1a3593d34caa23f7e961ee832aa9c5..b4d5f8f1c2ebe5f665480a209c55624ce54c4192 100644 (file)
@@ -2,11 +2,8 @@
 #define _XEN_IA64_PRIVOP_H
 
 #include <asm/ia64_int.h>
-//#ifdef CONFIG_VTI
 #include <asm/vmx_vcpu.h>
-//#else //CONFIG_VTI
 #include <asm/vcpu.h>
-//#endif //CONFIG_VTI
 
 typedef unsigned long IA64_INST;
 
index 6f99a392a6bd7a89e378fc7c3c0a0e1a7b5956ac..f0729b3e0aa7b0c09eb9d60969318d68508cdeab 100644 (file)
@@ -62,7 +62,7 @@ extern u64 set_isr_ei_ni (VCPU *vcpu);
 extern u64 set_isr_for_na_inst(VCPU *vcpu, int op);
 
 
-/* next all for CONFIG_VTI APIs definition */
+/* next all for VTI domain APIs definition */
 extern void vmx_vcpu_set_psr(VCPU *vcpu, unsigned long value);
 extern UINT64 vmx_vcpu_sync_mpsr(UINT64 mipsr, UINT64 value);
 extern void vmx_vcpu_set_psr_sync_mpsr(VCPU * vcpu, UINT64 value);
@@ -252,12 +252,9 @@ IA64FAULT
 vmx_vcpu_set_itm(VCPU *vcpu, u64 val)
 {
     vtime_t     *vtm;
-    
     vtm=&(vcpu->arch.arch_vmx.vtm);
     VCPU(vcpu,itm)=val;
-#ifdef CONFIG_VTI
     vtm_interruption_update(vcpu, vtm);
-#endif
     return IA64_NO_FAULT;
 }
 static inline
@@ -292,9 +289,7 @@ static inline
 IA64FAULT
 vmx_vcpu_set_eoi(VCPU *vcpu, u64 val)
 {
-#ifdef CONFIG_VTI
     guest_write_eoi(vcpu);
-#endif
     return IA64_NO_FAULT;
 }
 
@@ -304,9 +299,7 @@ vmx_vcpu_set_itv(VCPU *vcpu, u64 val)
 {
 
     VCPU(vcpu,itv)=val;
-#ifdef CONFIG_VTI
     vtm_set_itv(vcpu);
-#endif
     return IA64_NO_FAULT;
 }
 static inline
@@ -347,17 +340,13 @@ vmx_vcpu_set_lrr1(VCPU *vcpu, u64 val)
 static inline
 IA64FAULT vmx_vcpu_set_itc(VCPU *vcpu, UINT64 val)
 {
-#ifdef CONFIG_VTI
     vtm_set_itc(vcpu, val);
-#endif
     return  IA64_NO_FAULT;
 }
 static inline
 IA64FAULT vmx_vcpu_get_itc(VCPU *vcpu,UINT64 *val)
 {
-#ifdef CONFIG_VTI
     *val = vtm_get_itc(vcpu);
-#endif
     return  IA64_NO_FAULT;
 }
 static inline
index 95284f8a77072c128d7d0b665a9686f6756c7cfc..d204141fcb34b48efc6c0fb90586a09a59a885ce 100644 (file)
@@ -34,7 +34,7 @@
 #define IA64_HAS_EXTRA_STATE(t) 0
 
 #undef __switch_to
-#ifdef CONFIG_VTI
+#if     1
 extern struct task_struct *vmx_ia64_switch_to (void *next_task);
 #define __switch_to(prev,next,last) do {       \
        ia64_save_fpu(prev->arch._thread.fph);  \
@@ -51,10 +51,13 @@ extern struct task_struct *vmx_ia64_switch_to (void *next_task);
                if (IA64_HAS_EXTRA_STATE(next)) \
                        ia64_save_extra(next);  \
        }                                       \
-       ia64_psr(ia64_task_regs(next))->dfh = !ia64_is_local_fpu_owner(next); \
-       (last) = vmx_ia64_switch_to((next));        \
+       /*ia64_psr(ia64_task_regs(next))->dfh = !ia64_is_local_fpu_owner(next);*/                        \
+       (last) = ia64_switch_to((next));        \
+       if (!VMX_DOMAIN(current)){                   \
+          vcpu_set_next_timer(current);                \
+       }                                       \
 } while (0)
-#else // CONFIG_VTI
+#else
 #define __switch_to(prev,next,last) do {                                                        \
        ia64_save_fpu(prev->arch._thread.fph);                                                  \
        ia64_load_fpu(next->arch._thread.fph);                                                  \
@@ -66,7 +69,7 @@ extern struct task_struct *vmx_ia64_switch_to (void *next_task);
        (last) = ia64_switch_to((next));                                                         \
        vcpu_set_next_timer(current);                                                           \
 } while (0)
-#endif // CONFIG_VTI
+#endif
 
 #undef switch_to
 // FIXME SMP... see system.h, does this need to be different?
index d25ec18fcf6b4dd477842e9c93392900ad7f394f..e6e5c48f8ea8f48503daf0e6ba84be77e98c5d44 100644 (file)
@@ -232,13 +232,9 @@ typedef struct {
                // FIXME: tmp[8] temp'ly being used for virtual psr.pp
          };
         };
-#if 0
-#ifdef CONFIG_VTI
        unsigned long           reserved6[3456];
        unsigned long           vmm_avail[128];
        unsigned long           reserved7[4096];
-#endif
-#endif
 } mapped_regs_t;
 
 typedef struct {